3.347 \(\int \frac{3+\sec (c+d x)}{2-\sec (c+d x)} \, dx\)

Optimal. Leaf size=87 \[ -\frac{5 \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sqrt{3} \sin \left (\frac{1}{2} (c+d x)\right )\right )}{2 \sqrt{3} d}+\frac{5 \log \left (\sqrt{3} \sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )}{2 \sqrt{3} d}+\frac{3 x}{2} \]

[Out]

(3*x)/2 - (5*Log[Cos[(c + d*x)/2] - Sqrt[3]*Sin[(c + d*x)/2]])/(2*Sqrt[3]*d) + (5*Log[Cos[(c + d*x)/2] + Sqrt[
3]*Sin[(c + d*x)/2]])/(2*Sqrt[3]*d)

________________________________________________________________________________________

Rubi [A]  time = 0.0737429, antiderivative size = 87, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 21, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.19, Rules used = {3919, 3831, 2659, 207} \[ -\frac{5 \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sqrt{3} \sin \left (\frac{1}{2} (c+d x)\right )\right )}{2 \sqrt{3} d}+\frac{5 \log \left (\sqrt{3} \sin \left (\frac{1}{2} (c+d x)\right )+\cos \left (\frac{1}{2} (c+d x)\right )\right )}{2 \sqrt{3} d}+\frac{3 x}{2} \]

Antiderivative was successfully verified.

[In]

Int[(3 + Sec[c + d*x])/(2 - Sec[c + d*x]),x]

[Out]

(3*x)/2 - (5*Log[Cos[(c + d*x)/2] - Sqrt[3]*Sin[(c + d*x)/2]])/(2*Sqrt[3]*d) + (5*Log[Cos[(c + d*x)/2] + Sqrt[
3]*Sin[(c + d*x)/2]])/(2*Sqrt[3]*d)

Rule 3919

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[(c*x)/a,
x] - Dist[(b*c - a*d)/a, Int[Csc[e + f*x]/(a + b*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[
b*c - a*d, 0]

Rule 3831

Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Dist[1/b, Int[1/(1 + (a*Sin[e
 + f*x])/b), x], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 - b^2, 0]

Rule 2659

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[(2*e)/d, Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 207

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> -Simp[ArcTanh[(Rt[b, 2]*x)/Rt[-a, 2]]/(Rt[-a, 2]*Rt[b, 2]), x] /;
 FreeQ[{a, b}, x] && NegQ[a/b] && (LtQ[a, 0] || GtQ[b, 0])

Rubi steps

\begin{align*} \int \frac{3+\sec (c+d x)}{2-\sec (c+d x)} \, dx &=\frac{3 x}{2}+\frac{5}{2} \int \frac{\sec (c+d x)}{2-\sec (c+d x)} \, dx\\ &=\frac{3 x}{2}-\frac{5}{2} \int \frac{1}{1-2 \cos (c+d x)} \, dx\\ &=\frac{3 x}{2}-\frac{5 \operatorname{Subst}\left (\int \frac{1}{-1+3 x^2} \, dx,x,\tan \left (\frac{1}{2} (c+d x)\right )\right )}{d}\\ &=\frac{3 x}{2}-\frac{5 \log \left (\cos \left (\frac{1}{2} (c+d x)\right )-\sqrt{3} \sin \left (\frac{1}{2} (c+d x)\right )\right )}{2 \sqrt{3} d}+\frac{5 \log \left (\cos \left (\frac{1}{2} (c+d x)\right )+\sqrt{3} \sin \left (\frac{1}{2} (c+d x)\right )\right )}{2 \sqrt{3} d}\\ \end{align*}

Mathematica [A]  time = 0.0686279, size = 39, normalized size = 0.45 \[ \frac{9 (c+d x)+10 \sqrt{3} \tanh ^{-1}\left (\sqrt{3} \tan \left (\frac{1}{2} (c+d x)\right )\right )}{6 d} \]

Antiderivative was successfully verified.

[In]

Integrate[(3 + Sec[c + d*x])/(2 - Sec[c + d*x]),x]

[Out]

(9*(c + d*x) + 10*Sqrt[3]*ArcTanh[Sqrt[3]*Tan[(c + d*x)/2]])/(6*d)

________________________________________________________________________________________

Maple [A]  time = 0.074, size = 39, normalized size = 0.5 \begin{align*} 3\,{\frac{\arctan \left ( \tan \left ( 1/2\,dx+c/2 \right ) \right ) }{d}}+{\frac{5\,\sqrt{3}}{3\,d}{\it Artanh} \left ( \tan \left ({\frac{dx}{2}}+{\frac{c}{2}} \right ) \sqrt{3} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((3+sec(d*x+c))/(2-sec(d*x+c)),x)

[Out]

3/d*arctan(tan(1/2*d*x+1/2*c))+5/3/d*3^(1/2)*arctanh(tan(1/2*d*x+1/2*c)*3^(1/2))

________________________________________________________________________________________

Maxima [A]  time = 1.42947, size = 108, normalized size = 1.24 \begin{align*} -\frac{5 \, \sqrt{3} \log \left (-\frac{\sqrt{3} - \frac{3 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}}{\sqrt{3} + \frac{3 \, \sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}}\right ) - 18 \, \arctan \left (\frac{\sin \left (d x + c\right )}{\cos \left (d x + c\right ) + 1}\right )}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((3+sec(d*x+c))/(2-sec(d*x+c)),x, algorithm="maxima")

[Out]

-1/6*(5*sqrt(3)*log(-(sqrt(3) - 3*sin(d*x + c)/(cos(d*x + c) + 1))/(sqrt(3) + 3*sin(d*x + c)/(cos(d*x + c) + 1
))) - 18*arctan(sin(d*x + c)/(cos(d*x + c) + 1)))/d

________________________________________________________________________________________

Fricas [A]  time = 0.497372, size = 225, normalized size = 2.59 \begin{align*} \frac{18 \, d x + 5 \, \sqrt{3} \log \left (-\frac{2 \, \cos \left (d x + c\right )^{2} + 2 \,{\left (\sqrt{3} \cos \left (d x + c\right ) - 2 \, \sqrt{3}\right )} \sin \left (d x + c\right ) + 4 \, \cos \left (d x + c\right ) - 7}{4 \, \cos \left (d x + c\right )^{2} - 4 \, \cos \left (d x + c\right ) + 1}\right )}{12 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((3+sec(d*x+c))/(2-sec(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(18*d*x + 5*sqrt(3)*log(-(2*cos(d*x + c)^2 + 2*(sqrt(3)*cos(d*x + c) - 2*sqrt(3))*sin(d*x + c) + 4*cos(d*
x + c) - 7)/(4*cos(d*x + c)^2 - 4*cos(d*x + c) + 1)))/d

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} - \int \frac{\sec{\left (c + d x \right )}}{\sec{\left (c + d x \right )} - 2}\, dx - \int \frac{3}{\sec{\left (c + d x \right )} - 2}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((3+sec(d*x+c))/(2-sec(d*x+c)),x)

[Out]

-Integral(sec(c + d*x)/(sec(c + d*x) - 2), x) - Integral(3/(sec(c + d*x) - 2), x)

________________________________________________________________________________________

Giac [A]  time = 1.39533, size = 78, normalized size = 0.9 \begin{align*} \frac{9 \, d x - 5 \, \sqrt{3} \log \left (\frac{{\left | -2 \, \sqrt{3} + 6 \, \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) \right |}}{{\left | 2 \, \sqrt{3} + 6 \, \tan \left (\frac{1}{2} \, d x + \frac{1}{2} \, c\right ) \right |}}\right ) + 9 \, c}{6 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((3+sec(d*x+c))/(2-sec(d*x+c)),x, algorithm="giac")

[Out]

1/6*(9*d*x - 5*sqrt(3)*log(abs(-2*sqrt(3) + 6*tan(1/2*d*x + 1/2*c))/abs(2*sqrt(3) + 6*tan(1/2*d*x + 1/2*c))) +
 9*c)/d